Код:
	# Iron Raven's Buffs Timer Module
module IR_BUFFS_TIMER
  def self.check_notes(note)
    # Читаем примечание
    if note =~ /<\s*IR\s+Buffs\s+timer\s*>(\s*\d+\s*,\s*(ntg|\d+)\s*,\s*(ntg|\d+)\s*)/
      values = $1.strip.split(",").map(&:strip)
      timer_value = values[0].to_i
      new_buff_id = values[1] == "ntg" ? nil : values[1].to_i
      common_event_id = values[2] == "ntg" ? nil : values[2].to_i
      return [timer_value, new_buff_id, common_event_id]
    end
    return nil
  end
  def self.check_statuses
    members = $game_party.members
    members.each do |actor|
      actor.states.each do |state|
        note_data = check_notes(state.note)
        next if note_data.nil?
        timer_value, new_buff_id, common_event_id = note_data
        duration = actor.state_duration(state.id)
        next unless duration > timer_value
        handle_buff_timer(actor, state.id, new_buff_id, common_event_id)
      end
    end
  end
  def self.handle_buff_timer(actor, buff_id, new_buff_id, common_event_id)
    if common_event_id
      $game_temp.reserve_common_event(common_event_id)
    end
    if new_buff_id && !actor.states.include?(new_buff_id)
      actor.add_state(new_buff_id)
    end
    actor.set_state_timer(buff_id, 0)
  end
end
# Параллельный процесс для проверки статусов
class Scene_Map
  alias ir_map_update update
  def update
    ir_map_update
    IR_BUFFS_TIMER.check_statuses
  end
end
 
Социальные закладки